

. .\Lib.Strings.ps1


Set-PSDebug -Strict

[string]	$String	= "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vel tellus nonummy."
[byte[]]	$Bytes	= $null
[string]	$Base64	= ""

Write-Host "`n--- Testing Ascii string conversion ---"
Write-Host "Original string            = '$String'"

$Bytes = AsciiString2Bytes $String
Write-Host "Original byte count        = $($Bytes.Length)"

$Base64 = Bytes2Base64String $Bytes
Write-Host "Base64 string              = '$Base64'"

$Bytes = Base64String2Bytes $Base64
Write-Host "Converted byte count       = $($Bytes.Length)"

$String = Bytes2AsciiString $Bytes
Write-Host "Converted string           = '$String'"

Write-Host "`n--- Testing Unicode string conversion ---"
Write-Host "Original string            = '$String'"

$Bytes = UnicodeString2Bytes $String
Write-Host "Original byte count        = $($Bytes.Length)"

$Base64 = Bytes2Base64String $Bytes
Write-Host "Base64 string              = '$Base64'"

$Bytes = Base64String2Bytes $Base64
Write-Host "Converted byte count       = $($Bytes.Length)"

$String = Bytes2UnicodeString $Bytes
Write-Host "Converted string           = '$String'"

